﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using DAO;

namespace Banking.Nhân_viên
{
    public partial class frmRutTien : Form
    {
        TaiKhoanThe tk;
        LoaiGD LoaiGD;
        int MaKH;
        TypeDemo type;
        public frmRutTien(int makh,TypeDemo typedemo)
        {
            InitializeComponent();
            MaKH = makh;
            type = typedemo;
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            GiaoDich gd = new GiaoDich();
            gd.MaTKThe = Convert.ToInt32(txtMaTKThe.Text);
            gd.MaLoaiGD = 1;
            gd.NgayGD = Convert.ToDateTime(dtNgayGD.Value);
            gd.DiaChiGD = txtDiaChi.Text;
            gd.SoTienGD = Convert.ToInt32(txtSoTien.Text);
            gd.NoiDungGD = txtNoiDung.Text;
            gd.TrangThai = "0";
            gd.MaNVGD = 3;//maNV khi dang nhap
            if (GiaoDichDA.InsertRutTien(gd, type.typeDemo))
                MessageBox.Show("Success");
            else
                MessageBox.Show("Error");
        }

        private void frmRutTien_Load(object sender, EventArgs e)
        {
            txtMaTKThe.Text = MaKH.ToString();
            dtNgayGD.Value = DateTime.Today;
        }
    }
}
